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