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 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 69) LDISKFS_SERIES="2.6-rhel6.9.series" ;;
20 68) LDISKFS_SERIES="2.6-rhel6.8.series" ;;
21 67) LDISKFS_SERIES="2.6-rhel6.7.series" ;;
22 66) LDISKFS_SERIES="2.6-rhel6.6.series" ;;
23 65) LDISKFS_SERIES="2.6-rhel6.5.series" ;;
24 64) LDISKFS_SERIES="2.6-rhel6.4.series" ;;
25 6[0-3]) LDISKFS_SERIES="2.6-rhel6.series" ;;
27 ], [test x$SUSE_KERNEL = xyes], [
28 AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0],[
29 AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
30 AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
31 AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
32 [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
33 [LDISKFS_SERIES="3.0-sles11.series"],[
34 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
36 2) LDISKFS_SERIES="3.0-sles11.series"
38 3) LDISKFS_SERIES="3.0-sles11sp3.series"
40 4) LDISKFS_SERIES="3.0-sles11sp4.series"
43 ])],[LDISKFS_SERIES="3.12-sles12.series"],[
44 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
46 1) LDISKFS_SERIES="3.12-sles12sp1.series"
48 *) LDISKFS_SERIES="3.12-sles12.series"
51 ])],[LDISKFS_SERIES="4.4-sles12sp2.series"],
52 [LDISKFS_SERIES="4.4-sles12sp2.series"])
55 AS_IF([test -z "$LDISKFS_SERIES"],
56 [AC_MSG_RESULT([failed to identify series])],
57 [AC_MSG_RESULT([$LDISKFS_SERIES])])
58 AC_SUBST(LDISKFS_SERIES)
59 ]) # LDISKFS_LINUX_SERIES
62 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
64 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
65 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
67 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
68 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
69 ext4_free_blocks_with_buffer_head, [
71 #include "$EXT4_SRC_DIR/ext4.h"
73 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
75 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
76 [ext4_free_blocks do not require struct buffer_head])
78 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
83 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
85 AC_DEFUN([LB_EXT_PBLOCK], [
86 LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
89 #include "$EXT4_SRC_DIR/ext4_extents.h"
93 AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
98 # LB_EXT4_JOURNAL_START_3ARGS
100 # 3.9 added a type argument to ext4_journal_start and friends
102 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
103 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
104 ext4_journal_start, [
105 #include <linux/fs.h>
106 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
108 ext4_journal_start(NULL, 0, 0);
110 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
112 ]) # LB_EXT4_JOURNAL_START_3ARGS
115 # LB_LDISKFS_MAP_BLOCKS
117 # Since 2.6.35 brought ext4_map_blocks() for IO.
118 # We just check this function whether existed.
119 # it must be exported by ldiskfs patches.
121 AC_DEFUN([LB_LDISKFS_MAP_BLOCKS], [
122 LB_CHECK_COMPILE([if kernel has ext4_map_blocks],
124 #include <linux/fs.h>
125 #include "$EXT4_SRC_DIR/ext4.h"
127 ext4_map_blocks(NULL, NULL, NULL, 0);
129 AC_DEFINE(HAVE_LDISKFS_MAP_BLOCKS, 1, [kernel has ext4_map_blocks])
134 # LB_EXT4_BREAD_4ARGS
136 # 3.18 ext4_bread has 4 arguments
138 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
139 LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
141 #include <linux/fs.h>
142 #include "$EXT4_SRC_DIR/ext4.h"
144 ext4_bread(NULL, NULL, 0, 0);
146 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
148 ]) # LB_EXT4_BREAD_4ARGS
151 # LB_EXT4_HAVE_INFO_DQUOT
153 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
155 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
156 LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
158 #include <linux/fs.h>
159 #include <linux/quota.h>
160 #include "$EXT4_SRC_DIR/ext4.h"
162 struct ext4_inode_info in;
167 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
169 ]) # LB_EXT4_HAVE_INFO_DQUOT
172 # LDISKFS_AC_PATCH_PROGRAM
174 # Determine which program should be used to apply the patches to
175 # the ext4 source code to produce the ldiskfs source code.
177 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
178 AC_ARG_ENABLE([quilt],
179 [AC_HELP_STRING([--disable-quilt],
180 [disable use of quilt for ldiskfs])],
181 [AS_IF([test "x$enableval" = xno],
187 AS_IF([test x$use_quilt = xmaybe], [
188 AC_PATH_PROG([quilt_avail], [quilt], [no])
189 AS_IF([test x$quilt_avail = xno], [
196 AS_IF([test x$use_quilt = xno], [
197 AC_PATH_PROG([patch_avail], [patch], [no])
198 AS_IF([test x$patch_avail = xno], [
199 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
202 ]) # LDISKFS_AC_PATCH_PROGRAM
207 AC_DEFUN([LB_CONFIG_LDISKFS], [
208 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
209 # However we continue to support this option through Lustre 2.5.
210 AC_ARG_WITH([ldiskfs],
212 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
213 AS_IF([test x$withval != xyes -a x$withval != xno],
216 The ldiskfs option is deprecated,
217 and no longer supports paths to external ldiskfs source
221 AC_ARG_ENABLE([ldiskfs],
222 [AS_HELP_STRING([--disable-ldiskfs],
223 [disable ldiskfs osd (default is enable)])],
224 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
225 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
226 [AS_IF([test "${with_ldiskfs+set}" = set],
227 [enable_ldiskfs=$with_ldiskfs],
228 [enable_ldiskfs=maybe])
231 AS_IF([test x$enable_server = xno],
232 [AS_CASE([$enable_ldiskfs],
233 [maybe], [enable_ldiskfs=no],
234 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
237 AS_IF([test x$enable_ldiskfs != xno],[
238 # In the future, we chould change enable_ldiskfs from maybe to
239 # either yes or no based on additional tests, e.g. whether a patch
240 # set is available for the detected kernel. For now, we just always
242 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
245 LDISKFS_AC_PATCH_PROGRAM
246 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
248 LB_EXT4_JOURNAL_START_3ARGS
249 LB_LDISKFS_MAP_BLOCKS
251 LB_EXT4_HAVE_INFO_DQUOT
252 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
253 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
254 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
255 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
256 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1, [enable encryption for ldiskfs])
257 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
258 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
261 AC_MSG_CHECKING([whether to build ldiskfs])
262 AC_MSG_RESULT([$enable_ldiskfs])
264 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
265 ]) # LB_CONFIG_LDISKFS
268 # LB_VALIDATE_EXT4_SRC_DIR
270 # Spot check the existence of several source files common to ext4.
271 # Detecting this at configure time allows us to avoid a potential build
272 # failure and provide a useful error message to explain what is wrong.
274 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
275 enable_ldiskfs_build="no"
276 AS_IF([test -n "$EXT4_SRC_DIR"], [
277 enable_ldiskfs_build="yes"
278 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
279 enable_ldiskfs_build="no"
280 AC_MSG_WARN([ext4 must exist for ldiskfs build])
282 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
283 enable_ldiskfs_build="no"
284 AC_MSG_WARN([ext4 must exist for ldiskfs build])
286 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
287 enable_ldiskfs_build="no"
288 AC_MSG_WARN([ext4 must exist for ldiskfs build])
290 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
291 enable_ldiskfs_build="no"
292 AC_MSG_WARN([ext4 must exist for ldiskfs build])
296 AS_IF([test "x$enable_ldiskfs_build" = xno], [
301 Disabling ldiskfs support because complete ext4 source does not exist.
303 If you are building using kernel-devel packages and require ldiskfs
304 server support then ensure that the matching kernel-debuginfo-common
305 and kernel-debuginfo-common-<arch> packages are installed.
308 ]) # LB_VALIDATE_EXT4_SRC_DIR
313 # Determine the location of the ext4 source code. It it required
314 # for several configure tests and to build ldiskfs.
316 AC_DEFUN([LB_EXT4_SRC_DIR], [
317 AC_MSG_CHECKING([ext4 source directory])
318 # Kernel ext source located with devel headers
320 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
321 EXT4_SRC_DIR="$linux_src/fs/ext4"
323 # Kernel ext source provided by kernel-debuginfo-common package
324 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
325 2>/dev/null | tail -1)
326 AS_IF([test -e "$linux_src/fs/ext4/super.c"],
327 [EXT4_SRC_DIR="$linux_src/fs/ext4"],
330 AC_MSG_RESULT([$EXT4_SRC_DIR])
331 AC_SUBST(EXT4_SRC_DIR)
333 LB_VALIDATE_EXT4_SRC_DIR
337 # LB_DEFINE_E2FSPROGS_NAMES
339 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
341 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
342 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
343 AC_ARG_WITH([ldiskfsprogs],
344 AC_HELP_STRING([--with-ldiskfsprogs],
345 [use alternate names for ldiskfs-enabled e2fsprogs]),
348 AS_IF([test "x$withval" = xyes], [
349 AC_MSG_RESULT([enabled])
350 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
351 E2FSPROGS="ldiskfsprogs"
352 MKE2FS="mkfs.ldiskfs"
353 DEBUGFS="debugfs.ldiskfs"
354 TUNE2FS="tunefs.ldiskfs"
355 E2LABEL="label.ldiskfs"
356 DUMPE2FS="dumpfs.ldiskfs"
357 E2FSCK="fsck.ldiskfs"
358 PFSCK="pfsck.ldiskfs"
360 AC_MSG_RESULT([disabled])
361 E2FSPROGS="e2fsprogs"
371 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
372 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
373 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
374 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
375 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
376 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
377 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
378 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
380 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
381 AC_SUBST([MKE2FS], [$MKE2FS])
382 AC_SUBST([DEBUGFS], [$DEBUGFS])
383 AC_SUBST([TUNE2FS], [$TUNE2FS])
384 AC_SUBST([E2LABEL], [$E2LABEL])
385 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
386 AC_SUBST([E2FSCK], [$E2FSCK])
387 AC_SUBST([PFSCK], [$PFSCK])
388 ]) # LB_DEFINE_E2FSPROGS_NAMES