4 AC_DEFUN([LDISKFS_LINUX_SERIES], [
5 AC_MSG_CHECKING([which ldiskfs series to use])
6 case x$LDISKFS_SERIES in
9 *.series) # set externally
13 AS_IF([test -z "$LDISKFS_SERIES"], [
14 AS_IF([test x$RHEL_KERNEL = xyes], [
15 case $RHEL_RELEASE_NO in
16 74) LDISKFS_SERIES="3.10-rhel7.4.series" ;;
17 73) LDISKFS_SERIES="3.10-rhel7.3.series" ;;
18 72) LDISKFS_SERIES="3.10-rhel7.2.series" ;;
19 71) LDISKFS_SERIES="3.10-rhel7.series" ;;
20 69) LDISKFS_SERIES="2.6-rhel6.9.series" ;;
21 68) LDISKFS_SERIES="2.6-rhel6.8.series" ;;
22 67) LDISKFS_SERIES="2.6-rhel6.7.series" ;;
23 66) LDISKFS_SERIES="2.6-rhel6.6.series" ;;
24 65) LDISKFS_SERIES="2.6-rhel6.5.series" ;;
25 64) LDISKFS_SERIES="2.6-rhel6.4.series" ;;
26 6[0-3]) LDISKFS_SERIES="2.6-rhel6.series" ;;
28 ], [test x$SUSE_KERNEL = xyes], [
29 AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.82],[
30 AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0],[
31 AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
32 AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
33 AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
34 [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
35 [LDISKFS_SERIES="3.0-sles11.series"],[
36 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
38 2) LDISKFS_SERIES="3.0-sles11.series"
40 3) LDISKFS_SERIES="3.0-sles11sp3.series"
42 4) LDISKFS_SERIES="3.0-sles11sp4.series"
45 ])],[LDISKFS_SERIES="3.12-sles12.series"],[
46 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
48 1) LDISKFS_SERIES="3.12-sles12sp1.series"
50 *) LDISKFS_SERIES="3.12-sles12.series"
53 ])],[LDISKFS_SERIES="4.4-sles12sp2.series"],
54 [LDISKFS_SERIES="4.4-sles12sp2.series"]
55 )], [LDISKFS_SERIES="4.4-sles12sp3.series"],
56 [LDISKFS_SERIES="4.4-sles12sp3.series"])
59 AS_IF([test -z "$LDISKFS_SERIES"],
60 [AC_MSG_RESULT([failed to identify series])],
61 [AC_MSG_RESULT([$LDISKFS_SERIES])])
62 AC_SUBST(LDISKFS_SERIES)
63 ]) # LDISKFS_LINUX_SERIES
66 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
68 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
69 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
71 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
72 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
73 ext4_free_blocks_with_buffer_head, [
75 #include "$EXT4_SRC_DIR/ext4.h"
77 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
79 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
80 [ext4_free_blocks do not require struct buffer_head])
82 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
87 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
89 AC_DEFUN([LB_EXT_PBLOCK], [
90 LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
93 #include "$EXT4_SRC_DIR/ext4_extents.h"
97 AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
102 # LB_EXT4_JOURNAL_START_3ARGS
104 # 3.9 added a type argument to ext4_journal_start and friends
106 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
107 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
108 ext4_journal_start, [
109 #include <linux/fs.h>
110 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
112 ext4_journal_start(NULL, 0, 0);
114 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
116 ]) # LB_EXT4_JOURNAL_START_3ARGS
119 # LB_LDISKFS_MAP_BLOCKS
121 # Since 2.6.35 brought ext4_map_blocks() for IO.
122 # We just check this function whether existed.
123 # it must be exported by ldiskfs patches.
125 AC_DEFUN([LB_LDISKFS_MAP_BLOCKS], [
126 LB_CHECK_COMPILE([if kernel has ext4_map_blocks],
128 #include <linux/fs.h>
129 #include "$EXT4_SRC_DIR/ext4.h"
131 ext4_map_blocks(NULL, NULL, NULL, 0);
133 AC_DEFINE(HAVE_LDISKFS_MAP_BLOCKS, 1, [kernel has ext4_map_blocks])
138 # LB_EXT4_BREAD_4ARGS
140 # 3.18 ext4_bread has 4 arguments
142 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
143 LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
145 #include <linux/fs.h>
146 #include "$EXT4_SRC_DIR/ext4.h"
148 ext4_bread(NULL, NULL, 0, 0);
150 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
152 ]) # LB_EXT4_BREAD_4ARGS
155 # LB_EXT4_HAVE_INFO_DQUOT
157 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
159 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
160 LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
162 #include <linux/fs.h>
163 #include <linux/quota.h>
164 #include "$EXT4_SRC_DIR/ext4.h"
166 struct ext4_inode_info in;
171 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
173 ]) # LB_EXT4_HAVE_INFO_DQUOT
176 # LDISKFS_AC_PATCH_PROGRAM
178 # Determine which program should be used to apply the patches to
179 # the ext4 source code to produce the ldiskfs source code.
181 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
182 AC_ARG_ENABLE([quilt],
183 [AC_HELP_STRING([--disable-quilt],
184 [disable use of quilt for ldiskfs])],
185 [AS_IF([test "x$enableval" = xno],
191 AS_IF([test x$use_quilt = xmaybe], [
192 AC_PATH_PROG([quilt_avail], [quilt], [no])
193 AS_IF([test x$quilt_avail = xno], [
200 AS_IF([test x$use_quilt = xno], [
201 AC_PATH_PROG([patch_avail], [patch], [no])
202 AS_IF([test x$patch_avail = xno], [
203 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
206 ]) # LDISKFS_AC_PATCH_PROGRAM
211 AC_DEFUN([LB_CONFIG_LDISKFS], [
212 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
213 # However we continue to support this option through Lustre 2.5.
214 AC_ARG_WITH([ldiskfs],
216 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
217 AS_IF([test x$withval != xyes -a x$withval != xno],
220 The ldiskfs option is deprecated,
221 and no longer supports paths to external ldiskfs source
225 AC_ARG_ENABLE([ldiskfs],
226 [AS_HELP_STRING([--disable-ldiskfs],
227 [disable ldiskfs osd (default is enable)])],
228 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
229 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
230 [AS_IF([test "${with_ldiskfs+set}" = set],
231 [enable_ldiskfs=$with_ldiskfs],
232 [enable_ldiskfs=maybe])
235 AS_IF([test x$enable_server = xno],
236 [AS_CASE([$enable_ldiskfs],
237 [maybe], [enable_ldiskfs=no],
238 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
241 AS_IF([test x$enable_ldiskfs != xno],[
242 # In the future, we chould change enable_ldiskfs from maybe to
243 # either yes or no based on additional tests, e.g. whether a patch
244 # set is available for the detected kernel. For now, we just always
246 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
249 LDISKFS_AC_PATCH_PROGRAM
250 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
252 LB_EXT4_JOURNAL_START_3ARGS
253 LB_LDISKFS_MAP_BLOCKS
255 LB_EXT4_HAVE_INFO_DQUOT
256 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
257 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
258 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
259 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
260 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1, [enable encryption for ldiskfs])
261 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
262 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
265 AC_MSG_CHECKING([whether to build ldiskfs])
266 AC_MSG_RESULT([$enable_ldiskfs])
268 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
269 ]) # LB_CONFIG_LDISKFS
272 # LB_VALIDATE_EXT4_SRC_DIR
274 # Spot check the existence of several source files common to ext4.
275 # Detecting this at configure time allows us to avoid a potential build
276 # failure and provide a useful error message to explain what is wrong.
278 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
279 enable_ldiskfs_build="no"
280 AS_IF([test -n "$EXT4_SRC_DIR"], [
281 enable_ldiskfs_build="yes"
282 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
283 enable_ldiskfs_build="no"
284 AC_MSG_WARN([ext4 must exist for ldiskfs build])
286 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
287 enable_ldiskfs_build="no"
288 AC_MSG_WARN([ext4 must exist for ldiskfs build])
290 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
291 enable_ldiskfs_build="no"
292 AC_MSG_WARN([ext4 must exist for ldiskfs build])
294 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
295 enable_ldiskfs_build="no"
296 AC_MSG_WARN([ext4 must exist for ldiskfs build])
300 AS_IF([test "x$enable_ldiskfs_build" = xno], [
305 Disabling ldiskfs support because complete ext4 source does not exist.
307 If you are building using kernel-devel packages and require ldiskfs
308 server support then ensure that the matching kernel-debuginfo-common
309 and kernel-debuginfo-common-<arch> packages are installed.
312 ]) # LB_VALIDATE_EXT4_SRC_DIR
317 # Determine the location of the ext4 source code. It it required
318 # for several configure tests and to build ldiskfs.
320 AC_DEFUN([LB_EXT4_SRC_DIR], [
321 AC_MSG_CHECKING([ext4 source directory])
322 # Kernel ext source located with devel headers
324 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
325 EXT4_SRC_DIR="$linux_src/fs/ext4"
327 # Kernel ext source provided by kernel-debuginfo-common package
328 # that extracted to $LINUX
329 linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
330 2>/dev/null | tail -1)
331 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
332 EXT4_SRC_DIR="$linux_src/fs/ext4"
334 # Kernel ext source provided by kernel-debuginfo-common package
335 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
336 2>/dev/null | tail -1)
337 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
338 EXT4_SRC_DIR="$linux_src/fs/ext4"
344 AC_MSG_RESULT([$EXT4_SRC_DIR])
345 AC_SUBST(EXT4_SRC_DIR)
347 LB_VALIDATE_EXT4_SRC_DIR
351 # LB_DEFINE_E2FSPROGS_NAMES
353 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
355 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
356 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
357 AC_ARG_WITH([ldiskfsprogs],
358 AC_HELP_STRING([--with-ldiskfsprogs],
359 [use alternate names for ldiskfs-enabled e2fsprogs]),
362 AS_IF([test "x$withval" = xyes], [
363 AC_MSG_RESULT([enabled])
364 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
365 E2FSPROGS="ldiskfsprogs"
366 MKE2FS="mkfs.ldiskfs"
367 DEBUGFS="debugfs.ldiskfs"
368 TUNE2FS="tunefs.ldiskfs"
369 E2LABEL="label.ldiskfs"
370 DUMPE2FS="dumpfs.ldiskfs"
371 E2FSCK="fsck.ldiskfs"
372 PFSCK="pfsck.ldiskfs"
374 AC_MSG_RESULT([disabled])
375 E2FSPROGS="e2fsprogs"
385 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
386 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
387 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
388 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
389 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
390 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
391 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
392 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
394 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
395 AC_SUBST([MKE2FS], [$MKE2FS])
396 AC_SUBST([DEBUGFS], [$DEBUGFS])
397 AC_SUBST([TUNE2FS], [$TUNE2FS])
398 AC_SUBST([E2LABEL], [$E2LABEL])
399 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
400 AC_SUBST([E2FSCK], [$E2FSCK])
401 AC_SUBST([PFSCK], [$PFSCK])
402 ]) # LB_DEFINE_E2FSPROGS_NAMES