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 85) LDISKFS_SERIES="4.18-rhel8.5.series" ;;
17 84) LDISKFS_SERIES="4.18-rhel8.4.series" ;;
18 83) LDISKFS_SERIES="4.18-rhel8.3.series" ;;
19 82) LDISKFS_SERIES="4.18-rhel8.2.series" ;;
20 81) LDISKFS_SERIES="4.18-rhel8.1.series" ;;
21 80) LDISKFS_SERIES="4.18-rhel8.series" ;;
22 79) LDISKFS_SERIES="3.10-rhel7.9.series" ;;
23 78) LDISKFS_SERIES="3.10-rhel7.8.series" ;;
24 77) LDISKFS_SERIES="3.10-rhel7.7.series" ;;
25 76) LDISKFS_SERIES="3.10-rhel7.6.series" ;;
27 ], [test x$SUSE_KERNEL = xyes], [
28 AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
29 AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
30 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
31 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
32 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
33 echo "$suse_conf $suse_vers $suse_patchlevel ${suse_vers}sp$suse_patchlevel" >> /tmp/log-nb
34 case ${suse_vers}sp$suse_patchlevel in # (
35 15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
36 if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
37 # This file was added shortly after -150.22 so
38 # this must be 150.22 or earlier
39 LDISKFS_SERIES="4.12-sles15-22.series"
42 15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
43 if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
44 # This file was added after -197.7 so
45 # this must be -197.7 or earlier
46 LDISKFS_SERIES="4.12-sles15sp1-7.series"
51 )], [LDISKFS_SERIES="5.4.21-ml.series"],
53 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
54 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
55 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
56 echo "$suse_conf $suse_vers $suse_patchlevel ${suse_vers}sp$suse_patchlevel" >> /tmp/log-nb
58 case ${suse_vers}sp${suse_patchlevel} in # (
59 15sp2 ) LDISKFS_SERIES="5.4.21-ml.series"
60 grep -A3 ext4_update_dx_flag $LINUX/fs/ext4/ext4.h \
61 | grep ext4_test_inode_flag
62 if test $? -eq 0; then
63 LDISKFS_SERIES="5.4.0-66-ubuntu20.series"
66 15sp3 ) LDISKFS_SERIES="5.3.18-sles15sp3.series"
70 ], [test x$UBUNTU_KERNEL = xyes], [
71 AS_VERSION_COMPARE([$LINUXRELEASE],[5.8.0],[
72 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[
73 AS_VERSION_COMPARE([$LINUXRELEASE],[5.0.0],[
74 AS_VERSION_COMPARE([$LINUXRELEASE],[4.15.0],[
75 AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0], [],
77 KPLEV=$(echo $LINUXRELEASE | sed -n 's/.*-\([0-9]\+\).*/\1/p')
80 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
81 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
83 [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
84 [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
85 [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
86 [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
89 [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
91 KPLEV=$(echo $LINUXRELEASE | sed -n 's/.*-\([0-9]\+\).*/\1/p')
94 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
95 LDISKFS_SERIES="4.15.0-24-ubuntu18.series"
97 [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
98 [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
101 [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
102 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
103 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
104 [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
106 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
108 [test -z "$KPLEV"], [
109 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
110 LDISKFS_SERIES="5.4.0-90-ubuntu20.series"
112 [test $KPLEV -eq 1007], [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
113 [test $KPLEV -ge 90], [LDISKFS_SERIES="5.4.0-90-ubuntu20.series"],
114 [test $KPLEV -ge 80], [LDISKFS_SERIES="5.4.0-80-ubuntu20.series"],
115 [test $KPLEV -ge 66], [LDISKFS_SERIES="5.4.0-66-ubuntu20.series"],
116 [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"]
119 [LDISKFS_SERIES="5.4.0-ml.series"])],
120 [LDISKFS_SERIES="5.8.0-53-ubuntu20.series"],
121 [LDISKFS_SERIES="5.8.0-63-ubuntu20.series"],
122 [LDISKFS_SERIES="5.8.0-ml.series"])
125 # Not RHEL/SLES or Ubuntu .. probably mainline
126 AS_IF([test -z "$LDISKFS_SERIES"],
128 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
129 [LDISKFS_SERIES="5.4.0-ml.series"],[
130 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
131 [LDISKFS_SERIES="5.4.0-ml.series"], # lt
132 [LDISKFS_SERIES="5.4.21-ml.series"], # eq
133 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.8.0],
134 [LDISKFS_SERIES="5.4.136-ml.series"], # lt
135 [LDISKFS_SERIES="5.8.0-ml.series"], # eq
136 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.9.0],
137 [LDISKFS_SERIES="5.8.0-ml.series"], # lt
138 [LDISKFS_SERIES="5.9.0-ml.series"], # eq
139 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.10.0],
140 [LDISKFS_SERIES="5.9.0-ml.series"], # lt
141 [LDISKFS_SERIES="5.10.0-ml.series"], # eq
142 [LDISKFS_SERIES="5.10.0-ml.series"], # gt
149 AS_IF([test -z "$LDISKFS_SERIES"],
150 [AC_MSG_RESULT([failed to identify series])],
151 [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
152 AC_SUBST(LDISKFS_SERIES)
153 ]) # LDISKFS_LINUX_SERIES
156 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
158 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
159 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
161 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
162 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
163 ext4_free_blocks_with_buffer_head, [
164 #include <linux/fs.h>
165 #include "$EXT4_SRC_DIR/ext4.h"
167 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
169 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
170 [ext4_free_blocks do not require struct buffer_head])
172 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
175 # LB_EXT4_JOURNAL_START_3ARGS
177 # 3.9 added a type argument to ext4_journal_start and friends
179 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
180 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
181 ext4_journal_start, [
182 #include <linux/fs.h>
183 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
185 ext4_journal_start(NULL, 0, 0);
187 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
189 ]) # LB_EXT4_JOURNAL_START_3ARGS
192 # LB_EXT4_BREAD_4ARGS
194 # 3.18 ext4_bread has 4 arguments
195 # NOTE: It may not be exported for modules, use a positive compiler test here.
197 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
198 LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
200 #include <linux/fs.h>
201 #include "$EXT4_SRC_DIR/ext4.h"
203 struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
204 ext4_lblk_t block, int map_flags)
206 struct buffer_head *bh = NULL;
214 ext4_bread(NULL, NULL, 0, 0);
216 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
218 ]) # LB_EXT4_BREAD_4ARGS
221 # LB_EXT4_HAVE_INFO_DQUOT
223 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
225 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
226 LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
228 #include <linux/fs.h>
229 #include <linux/quota.h>
230 #include "$EXT4_SRC_DIR/ext4.h"
232 struct ext4_inode_info in;
237 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
239 ]) # LB_EXT4_HAVE_INFO_DQUOT
242 # LB_EXT4_HAVE_I_CRYPT_INFO
244 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
246 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
247 # If we have i_crypt_info in ext4_inode_info, the config option
248 # should be enabled to make the ldiskfs module compilation happy.
249 # Otherwise i_crypy_info is in struct inode, we need to check kernel
250 # config option to determine that.
252 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
253 LB_CHECK_COMPILE([if i_crypt_info is in ext4_inode_info],
255 #define CONFIG_EXT4_FS_ENCRYPTION 1
256 #include <linux/fs.h>
257 #include "$EXT4_SRC_DIR/ext4.h"
259 struct ext4_inode_info in;
261 in.i_crypt_info = NULL;
264 CONFIG_LDISKFS_FS_ENCRYPTION, 1,
265 [enable encryption for ldiskfs]
268 LB_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
270 CONFIG_LDISKFS_FS_ENCRYPTION, 1,
271 [enable encryption for ldiskfs]
275 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
278 # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
280 # kernel 4.18.0-240.1.1.el8 and
281 # kernel 5.4 commit a413036791d040e33badcc634453a4d0c0705499
283 # ext4_journal_ensure_credits was introduced to ensure given handle
284 # has at least requested amount of credits available, and possibly
285 # restarting transaction if needed.
287 AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
288 tmp_flags="$EXTRA_KCFLAGS"
289 EXTRA_KCFLAGS="-Werror"
290 LB_CHECK_COMPILE([if 'ext4_journal_ensure_credits' exists],
291 ext4_journal_ensure_credits, [
292 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
293 int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
294 int extend_cred, int revoke_cred) { return 0; }
296 ext4_journal_ensure_credits(NULL, 0, 0);
298 AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
299 ['ext4_journal_ensure_credits' exists])
301 EXTRA_KCFLAGS="$tmp_flags"
302 ]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
305 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
307 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
308 # ext4_iget changed to a macro with 3 args was function with 2 args
310 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
311 tmp_flags="$EXTRA_KCFLAGS"
312 EXTRA_KCFLAGS="-Werror"
313 LB_CHECK_COMPILE([if ldiskfs_iget takes a flags argument],
315 #include <linux/fs.h>
316 #include "$EXT4_SRC_DIR/ext4.h"
318 int f = EXT4_IGET_SPECIAL;
321 AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
322 [if ldiskfs_iget takes a flags argument])
324 EXTRA_KCFLAGS="$tmp_flags"
325 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
328 # LDISKFS_AC_PATCH_PROGRAM
330 # Determine which program should be used to apply the patches to
331 # the ext4 source code to produce the ldiskfs source code.
333 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
334 AC_ARG_ENABLE([quilt],
335 [AC_HELP_STRING([--disable-quilt],
336 [disable use of quilt for ldiskfs])],
337 [AS_IF([test "x$enableval" = xno],
343 AS_IF([test x$use_quilt = xmaybe], [
344 AC_PATH_PROG([quilt_avail], [quilt], [no])
345 AS_IF([test x$quilt_avail = xno], [
352 AS_IF([test x$use_quilt = xno], [
353 AC_PATH_PROG([patch_avail], [patch], [no])
354 AS_IF([test x$patch_avail = xno], [
355 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
358 ]) # LDISKFS_AC_PATCH_PROGRAM
361 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
363 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
364 # ext4: avoid declaring fs inconsistent due to invalid file handles
365 # __ext4_find_entry became a helper function for ext4_find_entry
366 # conflicting with previous ldiskfs patches.
367 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
368 # avoid conflicting with __ext4_find_entry
370 # When the following check succeeds __ext4_find_entry helper is not
373 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
374 tmp_flags="$EXTRA_KCFLAGS"
375 EXTRA_KCFLAGS="-Werror"
376 LB_CHECK_COMPILE([if __ldiskfs_find_entry is available],
377 ldiskfs_find_entry_locked, [
378 #include <linux/fs.h>
379 #include "$EXT4_SRC_DIR/ext4.h"
380 #include "$EXT4_SRC_DIR/namei.c"
382 static int __ext4_find_entry(void) { return 0; }
384 int x = __ext4_find_entry();
387 AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
388 [if __ldiskfs_find_entry is available])
390 EXTRA_KCFLAGS="$tmp_flags"
391 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
394 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
396 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
397 # ext4fs_dirhash UNICODE support
399 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
400 tmp_flags="$EXTRA_KCFLAGS"
401 EXTRA_KCFLAGS="-Werror"
402 LB_CHECK_COMPILE([if ldiskfsfs_dirhash takes an inode argument],
404 #include <linux/fs.h>
405 #include "$EXT4_SRC_DIR/ext4.h"
407 int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
408 struct dx_hash_info *hinfo)
417 int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
420 AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
421 [ldiskfsfs_dirhash takes an inode argument])
423 EXTRA_KCFLAGS="$tmp_flags"
424 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
427 # LB_JBD2_H_TOTAL_CREDITS
429 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
430 # jbd2: Reserve space for revoke descriptor blocks
432 AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
433 tmp_flags="$EXTRA_KCFLAGS"
434 EXTRA_KCFLAGS="-Werror"
435 LB_CHECK_COMPILE([if struct jbd2_journal_handle has h_total_credits member],
436 handle_t_h_revoke_credits, [
437 #include <linux/jbd2.h>
439 int x = offsetof(struct jbd2_journal_handle, h_total_credits);
442 AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
443 [struct jbd2_journal_handle has h_total_credits member])
445 EXTRA_KCFLAGS="$tmp_flags"
446 ]) # LB_JBD2_H_TOTAL_CREDITS
449 # LB_EXT4_GET_BLOCKS_KEEP_SIZE
451 # kernel 5.6-rc4 commit 9e52484c713321e84e8834803a44ca0a001376d2
452 # ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag
454 AC_DEFUN([LB_EXT4_GET_BLOCKS_KEEP_SIZE], [
455 tmp_flags="$EXTRA_KCFLAGS"
456 EXTRA_KCFLAGS="-Werror"
457 LB_CHECK_COMPILE([if EXT4_GET_BLOCKS_KEEP_SIZE exists],
458 ext4_get_blocks_keep_size, [
459 #include <linux/fs.h>
460 #include "$EXT4_SRC_DIR/ext4.h"
462 int f = EXT4_IGET_SPECIAL;
465 AC_DEFINE(HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE, 1,
466 [EXT4_GET_BLOCKS_KEEP_SIZE hasn't been removed])
468 EXTRA_KCFLAGS="$tmp_flags"
469 ]) # LB_EXT4_GET_BLOCKS_KEEP_SIZE
474 AC_DEFUN([LB_CONFIG_LDISKFS], [
475 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
476 # However we continue to support this option through Lustre 2.5.
477 AC_ARG_WITH([ldiskfs],
479 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
480 AS_IF([test x$withval != xyes -a x$withval != xno],
483 The ldiskfs option is deprecated,
484 and no longer supports paths to external ldiskfs source
488 AC_ARG_ENABLE([ldiskfs],
489 [AS_HELP_STRING([--disable-ldiskfs],
490 [disable ldiskfs osd (default is enable)])],
491 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
492 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
493 [AS_IF([test "${with_ldiskfs+set}" = set],
494 [enable_ldiskfs=$with_ldiskfs],
495 [enable_ldiskfs=maybe])
498 AS_IF([test x$enable_server = xno],
499 [AS_CASE([$enable_ldiskfs],
500 [maybe], [enable_ldiskfs=no],
501 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
504 AS_IF([test x$enable_ldiskfs != xno],[
505 # In the future, we chould change enable_ldiskfs from maybe to
506 # either yes or no based on additional tests, e.g. whether a patch
507 # set is available for the detected kernel. For now, we just always
509 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
510 AC_SUBST(ENABLE_LDISKFS, yes)
513 LDISKFS_AC_PATCH_PROGRAM
514 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
515 LB_EXT4_JOURNAL_START_3ARGS
517 LB_EXT4_HAVE_INFO_DQUOT
518 LB_EXT4_HAVE_I_CRYPT_INFO
519 LB_LDISKFS_JOURNAL_ENSURE_CREDITS
520 LB_LDISKFS_IGET_HAS_FLAGS_ARG
521 LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
522 LB_LDISKFSFS_DIRHASH_WANTS_DIR
523 LB_JBD2_H_TOTAL_CREDITS
524 LB_EXT4_GET_BLOCKS_KEEP_SIZE
525 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
526 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
527 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
528 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
529 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
530 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
532 AC_SUBST(ENABLE_LDISKFS, no)
535 AC_MSG_CHECKING([whether to build ldiskfs])
536 AC_MSG_RESULT([$enable_ldiskfs])
538 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
539 ]) # LB_CONFIG_LDISKFS
542 AC_DEFUN([LB_EXT4_SRC_DIR_SRC], [])
543 AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [])
546 # LB_VALIDATE_EXT4_SRC_DIR
548 # Spot check the existence of several source files common to ext4.
549 # Detecting this at configure time allows us to avoid a potential build
550 # failure and provide a useful error message to explain what is wrong.
552 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
553 enable_ldiskfs_build="no"
554 AS_IF([test -n "$EXT4_SRC_DIR"], [
555 enable_ldiskfs_build="yes"
556 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
557 enable_ldiskfs_build="no"
558 AC_MSG_WARN([ext4 must exist for ldiskfs build])
560 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
561 enable_ldiskfs_build="no"
562 AC_MSG_WARN([ext4 must exist for ldiskfs build])
564 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
565 enable_ldiskfs_build="no"
566 AC_MSG_WARN([ext4 must exist for ldiskfs build])
568 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
569 enable_ldiskfs_build="no"
570 AC_MSG_WARN([ext4 must exist for ldiskfs build])
574 AS_IF([test "x$enable_ldiskfs_build" = xno], [
579 Disabling ldiskfs support because complete ext4 source does not exist.
581 If you are building using kernel-devel packages and require ldiskfs
582 server support then ensure that the matching kernel-debuginfo-common
583 and kernel-debuginfo-common-<arch> packages are installed.
586 ]) # LB_VALIDATE_EXT4_SRC_DIR
591 # Determine the location of the ext4 source code. It it required
592 # for several configure tests and to build ldiskfs.
594 AC_DEFUN([LB_EXT4_SRC_DIR], [
595 AC_MSG_CHECKING([ext4 source directory])
596 # Kernel ext source located with devel headers
598 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
599 EXT4_SRC_DIR="$linux_src/fs/ext4"
601 # Kernel ext source provided by kernel-debuginfo-common package
602 # that extracted to $LINUX
603 linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
604 2>/dev/null | tail -1)
605 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
606 EXT4_SRC_DIR="$linux_src/fs/ext4"
608 # Kernel ext source provided by kernel-debuginfo-common package
609 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
610 2>/dev/null | tail -1)
611 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
612 EXT4_SRC_DIR="$linux_src/fs/ext4"
618 AC_MSG_RESULT([$EXT4_SRC_DIR])
619 AC_SUBST(EXT4_SRC_DIR)
621 LB_VALIDATE_EXT4_SRC_DIR
625 # LB_DEFINE_E2FSPROGS_NAMES
627 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
629 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
630 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
631 AC_ARG_WITH([ldiskfsprogs],
632 AC_HELP_STRING([--with-ldiskfsprogs],
633 [use alternate names for ldiskfs-enabled e2fsprogs]),
636 AS_IF([test "x$withval" = xyes], [
637 AC_MSG_RESULT([enabled])
638 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
639 E2FSPROGS="ldiskfsprogs"
640 MKE2FS="mkfs.ldiskfs"
641 DEBUGFS="debugfs.ldiskfs"
642 TUNE2FS="tunefs.ldiskfs"
643 E2LABEL="label.ldiskfs"
644 DUMPE2FS="dumpfs.ldiskfs"
645 E2FSCK="fsck.ldiskfs"
646 PFSCK="pfsck.ldiskfs"
648 AC_MSG_RESULT([disabled])
649 E2FSPROGS="e2fsprogs"
659 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
660 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
661 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
662 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
663 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
664 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
665 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
666 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
668 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
669 AC_SUBST([MKE2FS], [$MKE2FS])
670 AC_SUBST([DEBUGFS], [$DEBUGFS])
671 AC_SUBST([TUNE2FS], [$TUNE2FS])
672 AC_SUBST([E2LABEL], [$E2LABEL])
673 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
674 AC_SUBST([E2FSCK], [$E2FSCK])
675 AC_SUBST([PFSCK], [$PFSCK])
676 ]) # LB_DEFINE_E2FSPROGS_NAMES