4 AC_DEFUN([LDISKFS_LINUX_SERIES], [
6 AC_MSG_CHECKING([which ldiskfs series to use])
7 AS_IF([test x$RHEL_KERNEL = xyes], [
8 case $RHEL_RELEASE_NO in
9 72) LDISKFS_SERIES="3.10-rhel7.2.series" ;;
10 71) LDISKFS_SERIES="3.10-rhel7.series" ;;
11 67) LDISKFS_SERIES="2.6-rhel6.7.series" ;;
12 66) LDISKFS_SERIES="2.6-rhel6.6.series" ;;
13 65) LDISKFS_SERIES="2.6-rhel6.5.series" ;;
14 64) LDISKFS_SERIES="2.6-rhel6.4.series" ;;
15 6[0-3]) LDISKFS_SERIES="2.6-rhel6.series" ;;
17 ], [test x$SUSE_KERNEL = xyes], [
18 AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
19 AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
20 AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
21 [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
22 [LDISKFS_SERIES="3.0-sles11.series"],[
23 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
25 2) LDISKFS_SERIES="3.0-sles11.series"
27 3|4) LDISKFS_SERIES="3.0-sles11sp3.series"
30 ])],[LDISKFS_SERIES="3.12-sles12.series"],[LDISKFS_SERIES="3.12-sles12.series"])
32 AS_IF([test -z "$LDISKFS_SERIES"],
33 [AC_MSG_WARN([Unknown kernel version $LDISKFS_VERSIONRELEASE])])
34 AC_MSG_RESULT([$LDISKFS_SERIES])
35 AC_SUBST(LDISKFS_SERIES)
36 ]) # LDISKFS_LINUX_SERIES
39 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
41 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
42 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
44 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
45 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
46 ext4_free_blocks_with_buffer_head, [
48 #include "$EXT4_SRC_DIR/ext4.h"
50 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
52 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
53 [ext4_free_blocks do not require struct buffer_head])
55 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
60 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
62 AC_DEFUN([LB_EXT_PBLOCK], [
63 LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
66 #include "$EXT4_SRC_DIR/ext4_extents.h"
70 AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
75 # LB_EXT4_JOURNAL_START_3ARGS
77 # 3.9 added a type argument to ext4_journal_start and friends
79 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
80 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
83 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
85 ext4_journal_start(NULL, 0, 0);
87 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
89 ]) # LB_EXT4_JOURNAL_START_3ARGS
92 # LB_LDISKFS_MAP_BLOCKS
94 # Since 2.6.35 brought ext4_map_blocks() for IO.
95 # We just check this function whether existed.
96 # it must be exported by ldiskfs patches.
98 AC_DEFUN([LB_LDISKFS_MAP_BLOCKS], [
99 LB_CHECK_COMPILE([if kernel has ext4_map_blocks],
101 #include <linux/fs.h>
102 #include "$EXT4_SRC_DIR/ext4.h"
104 ext4_map_blocks(NULL, NULL, NULL, 0);
106 AC_DEFINE(HAVE_LDISKFS_MAP_BLOCKS, 1, [kernel has ext4_map_blocks])
111 # LDISKFS_AC_PATCH_PROGRAM
113 # Determine which program should be used to apply the patches to
114 # the ext4 source code to produce the ldiskfs source code.
116 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
117 AC_ARG_ENABLE([quilt],
118 [AC_HELP_STRING([--disable-quilt],
119 [disable use of quilt for ldiskfs])],
120 [AS_IF([test "x$enableval" = xno],
126 AS_IF([test x$use_quilt = xmaybe], [
127 AC_PATH_PROG([quilt_avail], [quilt], [no])
128 AS_IF([test x$quilt_avail = xno], [
135 AS_IF([test x$use_quilt = xno], [
136 AC_PATH_PROG([patch_avail], [patch], [no])
137 AS_IF([test x$patch_avail = xno], [
138 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
141 ]) # LDISKFS_AC_PATCH_PROGRAM
146 AC_DEFUN([LB_CONFIG_LDISKFS], [
147 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
148 # However we continue to support this option through Lustre 2.5.
149 AC_ARG_WITH([ldiskfs],
151 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
152 AS_IF([test x$withval != xyes -a x$withval != xno],
155 The ldiskfs option is deprecated,
156 and no longer supports paths to external ldiskfs source
160 AC_ARG_ENABLE([ldiskfs],
161 [AS_HELP_STRING([--disable-ldiskfs],
162 [disable ldiskfs osd (default is enable)])],
163 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
164 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
165 [AS_IF([test "${with_ldiskfs+set}" = set],
166 [enable_ldiskfs=$with_ldiskfs],
167 [enable_ldiskfs=maybe])
170 AS_IF([test x$enable_server = xno],
171 [AS_CASE([$enable_ldiskfs],
172 [maybe], [enable_ldiskfs=no],
173 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
176 AS_IF([test x$enable_ldiskfs != xno],[
177 # In the future, we chould change enable_ldiskfs from maybe to
178 # either yes or no based on additional tests, e.g. whether a patch
179 # set is available for the detected kernel. For now, we just always
181 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
184 LDISKFS_AC_PATCH_PROGRAM
185 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
187 LB_EXT4_JOURNAL_START_3ARGS
188 LB_LDISKFS_MAP_BLOCKS
189 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
190 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
191 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
192 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
193 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
194 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
197 AC_MSG_CHECKING([whether to build ldiskfs])
198 AC_MSG_RESULT([$enable_ldiskfs])
200 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
201 ]) # LB_CONFIG_LDISKFS
204 # LB_VALIDATE_EXT4_SRC_DIR
206 # Spot check the existence of several source files common to ext4.
207 # Detecting this at configure time allows us to avoid a potential build
208 # failure and provide a useful error message to explain what is wrong.
210 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
211 enable_ldiskfs_build="no"
212 AS_IF([test -n "$EXT4_SRC_DIR"], [
213 enable_ldiskfs_build="yes"
214 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
215 enable_ldiskfs_build="no"
216 AC_MSG_WARN([ext4 must exist for ldiskfs build])
218 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
219 enable_ldiskfs_build="no"
220 AC_MSG_WARN([ext4 must exist for ldiskfs build])
222 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
223 enable_ldiskfs_build="no"
224 AC_MSG_WARN([ext4 must exist for ldiskfs build])
226 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
227 enable_ldiskfs_build="no"
228 AC_MSG_WARN([ext4 must exist for ldiskfs build])
232 AS_IF([test "x$enable_ldiskfs_build" = xno], [
237 Disabling ldiskfs support because complete ext4 source does not exist.
239 If you are building using kernel-devel packages and require ldiskfs
240 server support then ensure that the matching kernel-debuginfo-common
241 and kernel-debuginfo-common-<arch> packages are installed.
244 ]) # LB_VALIDATE_EXT4_SRC_DIR
249 # Determine the location of the ext4 source code. It it required
250 # for several configure tests and to build ldiskfs.
252 AC_DEFUN([LB_EXT4_SRC_DIR], [
253 AC_MSG_CHECKING([ext4 source directory])
254 # Kernel ext source located with devel headers
256 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
257 EXT4_SRC_DIR="$linux_src/fs/ext4"
259 # Kernel ext source provided by kernel-debuginfo-common package
260 linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
261 2>/dev/null | tail -1)
262 AS_IF([test -e "$linux_src/fs/ext4/super.c"],
263 [EXT4_SRC_DIR="$linux_src/fs/ext4"],
266 AC_MSG_RESULT([$EXT4_SRC_DIR])
267 AC_SUBST(EXT4_SRC_DIR)
269 LB_VALIDATE_EXT4_SRC_DIR
273 # LB_DEFINE_E2FSPROGS_NAMES
275 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
277 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
278 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
279 AC_ARG_WITH([ldiskfsprogs],
280 AC_HELP_STRING([--with-ldiskfsprogs],
281 [use alternate names for ldiskfs-enabled e2fsprogs]),
284 AS_IF([test "x$withval" = xyes], [
285 AC_MSG_RESULT([enabled])
286 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
287 E2FSPROGS="ldiskfsprogs"
288 MKE2FS="mkfs.ldiskfs"
289 DEBUGFS="debugfs.ldiskfs"
290 TUNE2FS="tunefs.ldiskfs"
291 E2LABEL="label.ldiskfs"
292 DUMPE2FS="dumpfs.ldiskfs"
293 E2FSCK="fsck.ldiskfs"
294 PFSCK="pfsck.ldiskfs"
296 AC_MSG_RESULT([disabled])
297 E2FSPROGS="e2fsprogs"
307 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
308 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
309 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
310 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
311 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
312 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
313 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
314 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
316 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
317 AC_SUBST([MKE2FS], [$MKE2FS])
318 AC_SUBST([DEBUGFS], [$DEBUGFS])
319 AC_SUBST([TUNE2FS], [$TUNE2FS])
320 AC_SUBST([E2LABEL], [$E2LABEL])
321 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
322 AC_SUBST([E2FSCK], [$E2FSCK])
323 AC_SUBST([PFSCK], [$PFSCK])
324 ]) # LB_DEFINE_E2FSPROGS_NAMES