Whamcloud - gitweb
LU-4423 ptlrpc: use 64-bit times in ptlrpc_enc_page_pool
[fs/lustre-release.git] / config / lustre-build-ldiskfs.m4
1 #
2 # LDISKFS_LINUX_SERIES
3 #
4 AC_DEFUN([LDISKFS_LINUX_SERIES], [
5 AC_MSG_CHECKING([which ldiskfs series to use])
6 case x$LDISKFS_SERIES in
7         x)                      # not set
8                 ;;
9         *.series)               # set externally
10                 ;;
11         *) LDISKFS_SERIES=
12 esac
13 AS_IF([test -z "$LDISKFS_SERIES"], [
14 AS_IF([test x$RHEL_KERNEL = xyes], [
15         case $RHEL_RELEASE_NO in
16         73)     LDISKFS_SERIES="3.10-rhel7.3.series"    ;;
17         72)     LDISKFS_SERIES="3.10-rhel7.2.series"    ;;
18         71)     LDISKFS_SERIES="3.10-rhel7.series"      ;;
19         68)     LDISKFS_SERIES="2.6-rhel6.8.series"     ;;
20         67)     LDISKFS_SERIES="2.6-rhel6.7.series"     ;;
21         66)     LDISKFS_SERIES="2.6-rhel6.6.series"     ;;
22         65)     LDISKFS_SERIES="2.6-rhel6.5.series"     ;;
23         64)     LDISKFS_SERIES="2.6-rhel6.4.series"     ;;
24         6[0-3]) LDISKFS_SERIES="2.6-rhel6.series"       ;;
25         esac
26 ], [test x$SUSE_KERNEL = xyes], [
27         AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0],[
28         AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
29         AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
30         AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
31         [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
32         [LDISKFS_SERIES="3.0-sles11.series"],[
33                 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
34                 case $PLEV in
35                 2) LDISKFS_SERIES="3.0-sles11.series"
36                         ;;
37                 3|4) LDISKFS_SERIES="3.0-sles11sp3.series"
38                         ;;
39                 esac
40         ])],[LDISKFS_SERIES="3.12-sles12.series"],[
41                 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
42                 case $PLEV in
43                 1) LDISKFS_SERIES="3.12-sles12sp1.series"
44                         ;;
45                 *) LDISKFS_SERIES="3.12-sles12.series"
46                         ;;
47                 esac
48         ])],[LDISKFS_SERIES="4.4-sles12sp2.series"],
49             [LDISKFS_SERIES="4.4-sles12sp2.series"])
50 ])
51 ])
52 AS_IF([test -z "$LDISKFS_SERIES"],
53         [AC_MSG_RESULT([failed to identify series])],
54         [AC_MSG_RESULT([$LDISKFS_SERIES])])
55 AC_SUBST(LDISKFS_SERIES)
56 ]) # LDISKFS_LINUX_SERIES
57
58 #
59 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
60 #
61 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
62 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
63 #
64 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
65 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
66 ext4_free_blocks_with_buffer_head, [
67         #include <linux/fs.h>
68         #include "$EXT4_SRC_DIR/ext4.h"
69 ],[
70         ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
71 ],[
72         AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
73                 [ext4_free_blocks do not require struct buffer_head])
74 ])
75 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
76
77 #
78 # LB_EXT_PBLOCK
79 #
80 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
81 #
82 AC_DEFUN([LB_EXT_PBLOCK], [
83 LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
84 ext_pblock, [
85         #include <linux/fs.h>
86         #include "$EXT4_SRC_DIR/ext4_extents.h"
87 ],[
88         ext_pblock(NULL);
89 ],[
90         AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
91 ])
92 ]) # LB_EXT_PBLOCK
93
94 #
95 # LB_EXT4_JOURNAL_START_3ARGS
96 #
97 # 3.9 added a type argument to ext4_journal_start and friends
98 #
99 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
100 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
101 ext4_journal_start, [
102         #include <linux/fs.h>
103         #include "$EXT4_SRC_DIR/ext4_jbd2.h"
104 ],[
105         ext4_journal_start(NULL, 0, 0);
106 ],[
107         AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
108 ])
109 ]) # LB_EXT4_JOURNAL_START_3ARGS
110
111 #
112 # LB_LDISKFS_MAP_BLOCKS
113 #
114 # Since 2.6.35 brought ext4_map_blocks() for IO.
115 # We just check this function whether existed.
116 # it must be exported by ldiskfs patches.
117 #
118 AC_DEFUN([LB_LDISKFS_MAP_BLOCKS], [
119 LB_CHECK_COMPILE([if kernel has ext4_map_blocks],
120 ext4_map_blocks, [
121         #include <linux/fs.h>
122         #include "$EXT4_SRC_DIR/ext4.h"
123 ],[
124         ext4_map_blocks(NULL, NULL, NULL, 0);
125 ],[
126         AC_DEFINE(HAVE_LDISKFS_MAP_BLOCKS, 1, [kernel has ext4_map_blocks])
127 ])
128 ])
129
130 #
131 # LB_EXT4_BREAD_4ARGS
132 #
133 # 3.18 ext4_bread has 4 arguments
134 #
135 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
136 LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
137 ext4_bread, [
138         #include <linux/fs.h>
139         #include "$EXT4_SRC_DIR/ext4.h"
140 ],[
141         ext4_bread(NULL, NULL, 0, 0);
142 ],[
143         AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
144 ])
145 ]) # LB_EXT4_BREAD_4ARGS
146
147 #
148 # LB_EXT4_HAVE_INFO_DQUOT
149 #
150 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
151 #
152 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
153 LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
154 ext4_info_dquot, [
155         #include <linux/fs.h>
156         #include <linux/quota.h>
157         #include "$EXT4_SRC_DIR/ext4.h"
158 ],[
159         struct ext4_inode_info in;
160         struct dquot *dq;
161
162         dq = in.i_dquot[0];
163 ],[
164         AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
165 ])
166 ]) # LB_EXT4_HAVE_INFO_DQUOT
167
168 #
169 # LDISKFS_AC_PATCH_PROGRAM
170 #
171 # Determine which program should be used to apply the patches to
172 # the ext4 source code to produce the ldiskfs source code.
173 #
174 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
175         AC_ARG_ENABLE([quilt],
176                 [AC_HELP_STRING([--disable-quilt],
177                         [disable use of quilt for ldiskfs])],
178                 [AS_IF([test "x$enableval" = xno],
179                         [use_quilt=no],
180                         [use_quilt=maybe])],
181                 [use_quilt=maybe]
182         )
183
184         AS_IF([test x$use_quilt = xmaybe], [
185                 AC_PATH_PROG([quilt_avail], [quilt], [no])
186                 AS_IF([test x$quilt_avail = xno], [
187                         use_quilt=no
188                 ], [
189                         use_quilt=yes
190                 ])
191         ])
192
193         AS_IF([test x$use_quilt = xno], [
194                 AC_PATH_PROG([patch_avail], [patch], [no])
195                 AS_IF([test x$patch_avail = xno], [
196                         AC_MSG_ERROR([*** Need "quilt" or "patch" command])
197                 ])
198         ])
199 ]) # LDISKFS_AC_PATCH_PROGRAM
200
201 #
202 # LB_CONFIG_LDISKFS
203 #
204 AC_DEFUN([LB_CONFIG_LDISKFS], [
205 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
206 # However we continue to support this option through Lustre 2.5.
207 AC_ARG_WITH([ldiskfs],
208         [],
209         [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
210         AS_IF([test x$withval != xyes -a x$withval != xno],
211                 [AC_MSG_ERROR([
212
213 The ldiskfs option is deprecated,
214 and no longer supports paths to external ldiskfs source
215 ])])
216 ])
217
218 AC_ARG_ENABLE([ldiskfs],
219         [AS_HELP_STRING([--disable-ldiskfs],
220                 [disable ldiskfs osd (default is enable)])],
221         [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
222                 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
223         [AS_IF([test "${with_ldiskfs+set}" = set],
224                 [enable_ldiskfs=$with_ldiskfs],
225                 [enable_ldiskfs=maybe])
226 ])
227
228 AS_IF([test x$enable_server = xno],
229         [AS_CASE([$enable_ldiskfs],
230                 [maybe], [enable_ldiskfs=no],
231                 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
232         )])
233
234 AS_IF([test x$enable_ldiskfs != xno],[
235         # In the future, we chould change enable_ldiskfs from maybe to
236         # either yes or no based on additional tests, e.g.  whether a patch
237         # set is available for the detected kernel.  For now, we just always
238         # set it to "yes".
239         AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
240
241         LDISKFS_LINUX_SERIES
242         LDISKFS_AC_PATCH_PROGRAM
243         LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
244         LB_EXT_PBLOCK
245         LB_EXT4_JOURNAL_START_3ARGS
246         LB_LDISKFS_MAP_BLOCKS
247         LB_EXT4_BREAD_4ARGS
248         LB_EXT4_HAVE_INFO_DQUOT
249         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
250         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
251         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
252         AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
253         AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1, [enable encryption for ldiskfs])
254         AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
255         AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
256 ])
257
258 AC_MSG_CHECKING([whether to build ldiskfs])
259 AC_MSG_RESULT([$enable_ldiskfs])
260
261 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
262 ]) # LB_CONFIG_LDISKFS
263
264 #
265 # LB_VALIDATE_EXT4_SRC_DIR
266 #
267 # Spot check the existence of several source files common to ext4.
268 # Detecting this at configure time allows us to avoid a potential build
269 # failure and provide a useful error message to explain what is wrong.
270 #
271 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
272 enable_ldiskfs_build="no"
273 AS_IF([test -n "$EXT4_SRC_DIR"], [
274         enable_ldiskfs_build="yes"
275         LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
276                 enable_ldiskfs_build="no"
277                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
278         ])
279         LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
280                 enable_ldiskfs_build="no"
281                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
282         ])
283         LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
284                 enable_ldiskfs_build="no"
285                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
286         ])
287         LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
288                 enable_ldiskfs_build="no"
289                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
290         ])
291 ])
292
293 AS_IF([test "x$enable_ldiskfs_build" = xno], [
294         enable_ldiskfs="no"
295
296         AC_MSG_WARN([
297
298 Disabling ldiskfs support because complete ext4 source does not exist.
299
300 If you are building using kernel-devel packages and require ldiskfs
301 server support then ensure that the matching kernel-debuginfo-common
302 and kernel-debuginfo-common-<arch> packages are installed.
303 ])
304 ])
305 ]) # LB_VALIDATE_EXT4_SRC_DIR
306
307 #
308 # LB_EXT4_SRC_DIR
309 #
310 # Determine the location of the ext4 source code.  It it required
311 # for several configure tests and to build ldiskfs.
312 #
313 AC_DEFUN([LB_EXT4_SRC_DIR], [
314 AC_MSG_CHECKING([ext4 source directory])
315 # Kernel ext source located with devel headers
316 linux_src=$LINUX
317 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
318         EXT4_SRC_DIR="$linux_src/fs/ext4"
319 ], [
320         # Kernel ext source provided by kernel-debuginfo-common package
321         linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
322                 2>/dev/null | tail -1)
323         AS_IF([test -e "$linux_src/fs/ext4/super.c"],
324                 [EXT4_SRC_DIR="$linux_src/fs/ext4"],
325                 [EXT4_SRC_DIR=""])
326 ])
327 AC_MSG_RESULT([$EXT4_SRC_DIR])
328 AC_SUBST(EXT4_SRC_DIR)
329
330 LB_VALIDATE_EXT4_SRC_DIR
331 ]) # LB_EXT4_SRC_DIR
332
333 #
334 # LB_DEFINE_E2FSPROGS_NAMES
335 #
336 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
337 #
338 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
339 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
340 AC_ARG_WITH([ldiskfsprogs],
341         AC_HELP_STRING([--with-ldiskfsprogs],
342                 [use alternate names for ldiskfs-enabled e2fsprogs]),
343         [], [withval="no"])
344
345 AS_IF([test "x$withval" = xyes], [
346         AC_MSG_RESULT([enabled])
347         AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
348         E2FSPROGS="ldiskfsprogs"
349         MKE2FS="mkfs.ldiskfs"
350         DEBUGFS="debugfs.ldiskfs"
351         TUNE2FS="tunefs.ldiskfs"
352         E2LABEL="label.ldiskfs"
353         DUMPE2FS="dumpfs.ldiskfs"
354         E2FSCK="fsck.ldiskfs"
355         PFSCK="pfsck.ldiskfs"
356 ], [
357         AC_MSG_RESULT([disabled])
358         E2FSPROGS="e2fsprogs"
359         MKE2FS="mke2fs"
360         DEBUGFS="debugfs"
361         TUNE2FS="tune2fs"
362         E2LABEL="e2label"
363         DUMPE2FS="dumpe2fs"
364         E2FSCK="e2fsck"
365         PFSCK="fsck"
366 ])
367
368 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
369 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
370 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
371 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
372 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
373 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
374 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
375 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
376
377 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
378 AC_SUBST([MKE2FS], [$MKE2FS])
379 AC_SUBST([DEBUGFS], [$DEBUGFS])
380 AC_SUBST([TUNE2FS], [$TUNE2FS])
381 AC_SUBST([E2LABEL], [$E2LABEL])
382 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
383 AC_SUBST([E2FSCK], [$E2FSCK])
384 AC_SUBST([PFSCK], [$PFSCK])
385 ]) # LB_DEFINE_E2FSPROGS_NAMES