Whamcloud - gitweb
LU-14020 ldiskfs: SUSE 15 SP2 and mainline 5.4.21 and newer
[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         82)     LDISKFS_SERIES="4.18-rhel8.2.series"    ;;
17         81)     LDISKFS_SERIES="4.18-rhel8.1.series"    ;;
18         80)     LDISKFS_SERIES="4.18-rhel8.series"      ;;
19         79)     LDISKFS_SERIES="3.10-rhel7.9.series"    ;;
20         78)     LDISKFS_SERIES="3.10-rhel7.8.series"    ;;
21         77)     LDISKFS_SERIES="3.10-rhel7.7.series"    ;;
22         76)     LDISKFS_SERIES="3.10-rhel7.6.series"    ;;
23         esac
24 ], [test x$SUSE_KERNEL = xyes], [
25         AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
26         AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
27                 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
28                 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
29                 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
30                 echo "$suse_conf $suse_vers $suse_patchlevel  ${suse_vers}sp$suse_patchlevel" >> /tmp/log-nb
31                 case ${suse_vers}sp$suse_patchlevel in # (
32                 15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
33                         if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
34                                 # This file was added shortly after -150.22 so
35                                 # this must be 150.22 or earlier
36                                 LDISKFS_SERIES="4.12-sles15-22.series"
37                         fi
38                         ;; # (
39                 15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
40                         if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
41                                 # This file was added after -197.7 so
42                                 # this must be -197.7 or earlier
43                                 LDISKFS_SERIES="4.12-sles15sp1-7.series"
44                         fi
45                         ;;
46                 esac
47         ]
48         )], [LDISKFS_SERIES="5.4.21-ml.series"],
49             [LDISKFS_SERIES="5.4.21-ml.series"])
50 ], [test x$UBUNTU_KERNEL = xyes], [
51         AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[
52         AS_VERSION_COMPARE([$LINUXRELEASE],[5.0.0],[
53         AS_VERSION_COMPARE([$LINUXRELEASE],[4.15.0],[
54         AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0], [],
55         [
56                 KPLEV=$(echo $LINUXRELEASE | sed -n 's/.*-\([0-9]\+\).*/\1/p')
57                 AS_IF(
58                         [test -z "$KPLEV"], [
59                                 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
60                                 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
61                         ],
62                         [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
63                         [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
64                         [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
65                         [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
66                 )
67         ],
68         [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
69         [
70                 KPLEV=$(echo $LINUXRELEASE | sed -n 's/.*-\([0-9]\+\).*/\1/p')
71                 AS_IF(
72                         [test -z "$KPLEV"], [
73                                 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
74                                 LDISKFS_SERIES="4.15.0-24-ubuntu18.series"
75                         ],
76                         [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
77                         [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
78                 )
79         ],
80         [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
81         [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
82         [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
83         [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
84         [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
85         [LDISKFS_SERIES="5.4.0-ml.series"])
86 ])
87 ])
88 # Not RHEL/SLES or Ubuntu .. probably mainline
89 AS_IF([test -z "$LDISKFS_SERIES"],
90         [
91         AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
92         [LDISKFS_SERIES="5.4.0-ml.series"],[
93         AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
94                 [LDISKFS_SERIES="5.4.0-ml.series"],  # lt
95                 [LDISKFS_SERIES="5.4.21-ml.series"], # eq
96                 [LDISKFS_SERIES="5.4.21-ml.series"]  # gt
97                 )])
98         ],
99 [])
100 AS_IF([test -z "$LDISKFS_SERIES"],
101         [AC_MSG_RESULT([failed to identify series])],
102         [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
103 AC_SUBST(LDISKFS_SERIES)
104 ]) # LDISKFS_LINUX_SERIES
105
106 #
107 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
108 #
109 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
110 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
111 #
112 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
113 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
114 ext4_free_blocks_with_buffer_head, [
115         #include <linux/fs.h>
116         #include "$EXT4_SRC_DIR/ext4.h"
117 ],[
118         ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
119 ],[
120         AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
121                 [ext4_free_blocks do not require struct buffer_head])
122 ])
123 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
124
125 #
126 # LB_EXT4_JOURNAL_START_3ARGS
127 #
128 # 3.9 added a type argument to ext4_journal_start and friends
129 #
130 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
131 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
132 ext4_journal_start, [
133         #include <linux/fs.h>
134         #include "$EXT4_SRC_DIR/ext4_jbd2.h"
135 ],[
136         ext4_journal_start(NULL, 0, 0);
137 ],[
138         AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
139 ])
140 ]) # LB_EXT4_JOURNAL_START_3ARGS
141
142 #
143 # LB_EXT4_BREAD_4ARGS
144 #
145 # 3.18 ext4_bread has 4 arguments
146 # NOTE: It may not be exported for modules, use a positive compiler test here.
147 #
148 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
149 LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
150 ext4_bread, [
151         #include <linux/fs.h>
152         #include "$EXT4_SRC_DIR/ext4.h"
153
154         struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
155                                        ext4_lblk_t block, int map_flags)
156         {
157                 struct buffer_head *bh = NULL;
158                 (void)handle;
159                 (void)inode;
160                 (void)block;
161                 (void)map_flags;
162                 return bh;
163         }
164 ],[
165         ext4_bread(NULL, NULL, 0, 0);
166 ],[
167         AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
168 ])
169 ]) # LB_EXT4_BREAD_4ARGS
170
171 #
172 # LB_EXT4_HAVE_INFO_DQUOT
173 #
174 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
175 #
176 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
177 LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
178 ext4_info_dquot, [
179         #include <linux/fs.h>
180         #include <linux/quota.h>
181         #include "$EXT4_SRC_DIR/ext4.h"
182 ],[
183         struct ext4_inode_info in;
184         struct dquot *dq;
185
186         dq = in.i_dquot[0];
187 ],[
188         AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
189 ])
190 ]) # LB_EXT4_HAVE_INFO_DQUOT
191
192 #
193 # LB_EXT4_HAVE_I_CRYPT_INFO
194 #
195 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
196 #
197 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
198 # If we have i_crypt_info in ext4_inode_info, the config option
199 # should be enabled to make the ldiskfs module compilation happy.
200 # Otherwise i_crypy_info is in struct inode, we need to check kernel
201 # config option to determine that.
202 #
203 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
204 LB_CHECK_COMPILE([if i_crypt_info is in ext4_inode_info],
205 ext4_i_crypt_info, [
206         #define CONFIG_EXT4_FS_ENCRYPTION 1
207         #include <linux/fs.h>
208         #include "$EXT4_SRC_DIR/ext4.h"
209 ],[
210         struct ext4_inode_info in;
211
212         in.i_crypt_info = NULL;
213 ],[
214         AC_DEFINE(
215                 CONFIG_LDISKFS_FS_ENCRYPTION, 1,
216                 [enable encryption for ldiskfs]
217         )
218 ],[
219         LB_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
220                 AC_DEFINE(
221                         CONFIG_LDISKFS_FS_ENCRYPTION, 1,
222                         [enable encryption for ldiskfs]
223                 )
224         ])
225 ])
226 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
227
228 #
229 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
230 #
231 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
232 # ext4_iget changed to a macro with 3 args was function with 2 args
233 #
234 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
235 tmp_flags="$EXTRA_KCFLAGS"
236 EXTRA_KCFLAGS="-Werror"
237 LB_CHECK_COMPILE([if ldiskfs_iget takes a flags argument],
238 ext4_iget_3args, [
239         #include <linux/fs.h>
240         #include "$EXT4_SRC_DIR/ext4.h"
241 ],[
242         int f = EXT4_IGET_SPECIAL;
243         (void)f;
244 ],[
245         AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
246                 [if ldiskfs_iget takes a flags argument])
247 ])
248 EXTRA_KCFLAGS="$tmp_flags"
249 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
250
251 #
252 # LDISKFS_AC_PATCH_PROGRAM
253 #
254 # Determine which program should be used to apply the patches to
255 # the ext4 source code to produce the ldiskfs source code.
256 #
257 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
258         AC_ARG_ENABLE([quilt],
259                 [AC_HELP_STRING([--disable-quilt],
260                         [disable use of quilt for ldiskfs])],
261                 [AS_IF([test "x$enableval" = xno],
262                         [use_quilt=no],
263                         [use_quilt=maybe])],
264                 [use_quilt=maybe]
265         )
266
267         AS_IF([test x$use_quilt = xmaybe], [
268                 AC_PATH_PROG([quilt_avail], [quilt], [no])
269                 AS_IF([test x$quilt_avail = xno], [
270                         use_quilt=no
271                 ], [
272                         use_quilt=yes
273                 ])
274         ])
275
276         AS_IF([test x$use_quilt = xno], [
277                 AC_PATH_PROG([patch_avail], [patch], [no])
278                 AS_IF([test x$patch_avail = xno], [
279                         AC_MSG_ERROR([*** Need "quilt" or "patch" command])
280                 ])
281         ])
282 ]) # LDISKFS_AC_PATCH_PROGRAM
283
284 #
285 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
286 #
287 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
288 # ext4: avoid declaring fs inconsistent due to invalid file handles
289 # __ext4_find_entry became a helper function for ext4_find_entry
290 # conflicting with previous ldiskfs patches.
291 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
292 # avoid conflicting with __ext4_find_entry
293 #
294 # When the following check succeeds __ext4_find_entry helper is not
295 # used.
296 #
297 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
298 tmp_flags="$EXTRA_KCFLAGS"
299 EXTRA_KCFLAGS="-Werror"
300 LB_CHECK_COMPILE([if __ldiskfs_find_entry is available],
301 ldiskfs_find_entry_locked, [
302         #include <linux/fs.h>
303         #include "$EXT4_SRC_DIR/ext4.h"
304         #include "$EXT4_SRC_DIR/namei.c"
305
306         static int __ext4_find_entry(void) { return 0; }
307 ],[
308         int x = __ext4_find_entry();
309         (void)x;
310 ],[
311         AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
312                 [if __ldiskfs_find_entry is available])
313 ])
314 EXTRA_KCFLAGS="$tmp_flags"
315 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
316
317 #
318 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
319 #
320 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
321 # ext4fs_dirhash UNICODE support
322 #
323 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
324 tmp_flags="$EXTRA_KCFLAGS"
325 EXTRA_KCFLAGS="-Werror"
326 LB_CHECK_COMPILE([if ldiskfsfs_dirhash takes an inode argument],
327 ext4fs_dirhash, [
328         #include <linux/fs.h>
329         #include "$EXT4_SRC_DIR/ext4.h"
330
331         int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
332                           struct dx_hash_info *hinfo)
333         {
334                 (void)dir;
335                 (void)name;
336                 (void)len;
337                 (void)hinfo;
338                 return 0;
339         }
340 ],[
341         int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
342         (void)f;
343 ],[
344         AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
345                 [ldiskfsfs_dirhash takes an inode argument])
346 ])
347 EXTRA_KCFLAGS="$tmp_flags"
348 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
349
350 #
351 # LB_JBD2_H_TOTAL_CREDITS
352 #
353 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
354 # jbd2: Reserve space for revoke descriptor blocks
355 #
356 AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
357 tmp_flags="$EXTRA_KCFLAGS"
358 EXTRA_KCFLAGS="-Werror"
359 LB_CHECK_COMPILE([if struct jbd2_journal_handle has h_total_credits member],
360 handle_t_h_revoke_credits, [
361         #include <linux/jbd2.h>
362 ],[
363         int x = offsetof(struct jbd2_journal_handle, h_total_credits);
364         (void)x;
365 ],[
366         AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
367                 [struct jbd2_journal_handle has h_total_credits member])
368 ])
369 EXTRA_KCFLAGS="$tmp_flags"
370 ]) # LB_JBD2_H_TOTAL_CREDITS
371
372 #
373 # LB_CONFIG_LDISKFS
374 #
375 AC_DEFUN([LB_CONFIG_LDISKFS], [
376 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
377 # However we continue to support this option through Lustre 2.5.
378 AC_ARG_WITH([ldiskfs],
379         [],
380         [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
381         AS_IF([test x$withval != xyes -a x$withval != xno],
382                 [AC_MSG_ERROR([
383
384 The ldiskfs option is deprecated,
385 and no longer supports paths to external ldiskfs source
386 ])])
387 ])
388
389 AC_ARG_ENABLE([ldiskfs],
390         [AS_HELP_STRING([--disable-ldiskfs],
391                 [disable ldiskfs osd (default is enable)])],
392         [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
393                 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
394         [AS_IF([test "${with_ldiskfs+set}" = set],
395                 [enable_ldiskfs=$with_ldiskfs],
396                 [enable_ldiskfs=maybe])
397 ])
398
399 AS_IF([test x$enable_server = xno],
400         [AS_CASE([$enable_ldiskfs],
401                 [maybe], [enable_ldiskfs=no],
402                 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
403         )])
404
405 AS_IF([test x$enable_ldiskfs != xno],[
406         # In the future, we chould change enable_ldiskfs from maybe to
407         # either yes or no based on additional tests, e.g.  whether a patch
408         # set is available for the detected kernel.  For now, we just always
409         # set it to "yes".
410         AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
411         AC_SUBST(ENABLE_LDISKFS, yes)
412
413         LDISKFS_LINUX_SERIES
414         LDISKFS_AC_PATCH_PROGRAM
415         LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
416         LB_EXT4_JOURNAL_START_3ARGS
417         LB_EXT4_BREAD_4ARGS
418         LB_EXT4_HAVE_INFO_DQUOT
419         LB_EXT4_HAVE_I_CRYPT_INFO
420         LB_LDISKFS_IGET_HAS_FLAGS_ARG
421         LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
422         LB_LDISKFSFS_DIRHASH_WANTS_DIR
423         LB_JBD2_H_TOTAL_CREDITS
424         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
425         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
426         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
427         AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
428         AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
429         AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
430 ], [
431         AC_SUBST(ENABLE_LDISKFS, no)
432 ])
433
434 AC_MSG_CHECKING([whether to build ldiskfs])
435 AC_MSG_RESULT([$enable_ldiskfs])
436
437 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
438 ]) # LB_CONFIG_LDISKFS
439
440
441 AC_DEFUN([LB_EXT4_SRC_DIR_SRC], [])
442 AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [])
443
444 #
445 # LB_VALIDATE_EXT4_SRC_DIR
446 #
447 # Spot check the existence of several source files common to ext4.
448 # Detecting this at configure time allows us to avoid a potential build
449 # failure and provide a useful error message to explain what is wrong.
450 #
451 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
452 enable_ldiskfs_build="no"
453 AS_IF([test -n "$EXT4_SRC_DIR"], [
454         enable_ldiskfs_build="yes"
455         LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
456                 enable_ldiskfs_build="no"
457                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
458         ])
459         LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
460                 enable_ldiskfs_build="no"
461                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
462         ])
463         LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
464                 enable_ldiskfs_build="no"
465                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
466         ])
467         LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
468                 enable_ldiskfs_build="no"
469                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
470         ])
471 ])
472
473 AS_IF([test "x$enable_ldiskfs_build" = xno], [
474         enable_ldiskfs="no"
475
476         AC_MSG_WARN([
477
478 Disabling ldiskfs support because complete ext4 source does not exist.
479
480 If you are building using kernel-devel packages and require ldiskfs
481 server support then ensure that the matching kernel-debuginfo-common
482 and kernel-debuginfo-common-<arch> packages are installed.
483 ])
484 ])
485 ]) # LB_VALIDATE_EXT4_SRC_DIR
486
487 #
488 # LB_EXT4_SRC_DIR
489 #
490 # Determine the location of the ext4 source code.  It it required
491 # for several configure tests and to build ldiskfs.
492 #
493 AC_DEFUN([LB_EXT4_SRC_DIR], [
494 AC_MSG_CHECKING([ext4 source directory])
495 # Kernel ext source located with devel headers
496 linux_src=$LINUX
497 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
498         EXT4_SRC_DIR="$linux_src/fs/ext4"
499 ], [
500         # Kernel ext source provided by kernel-debuginfo-common package
501         # that extracted to $LINUX
502         linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
503                 2>/dev/null | tail -1)
504         AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
505                 EXT4_SRC_DIR="$linux_src/fs/ext4"
506         ], [
507                 # Kernel ext source provided by kernel-debuginfo-common package
508                 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
509                         2>/dev/null | tail -1)
510                 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
511                         EXT4_SRC_DIR="$linux_src/fs/ext4"
512                 ], [
513                         EXT4_SRC_DIR=""
514                 ])
515         ])
516 ])
517 AC_MSG_RESULT([$EXT4_SRC_DIR])
518 AC_SUBST(EXT4_SRC_DIR)
519
520 LB_VALIDATE_EXT4_SRC_DIR
521 ]) # LB_EXT4_SRC_DIR
522
523 #
524 # LB_DEFINE_E2FSPROGS_NAMES
525 #
526 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
527 #
528 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
529 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
530 AC_ARG_WITH([ldiskfsprogs],
531         AC_HELP_STRING([--with-ldiskfsprogs],
532                 [use alternate names for ldiskfs-enabled e2fsprogs]),
533         [], [withval="no"])
534
535 AS_IF([test "x$withval" = xyes], [
536         AC_MSG_RESULT([enabled])
537         AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
538         E2FSPROGS="ldiskfsprogs"
539         MKE2FS="mkfs.ldiskfs"
540         DEBUGFS="debugfs.ldiskfs"
541         TUNE2FS="tunefs.ldiskfs"
542         E2LABEL="label.ldiskfs"
543         DUMPE2FS="dumpfs.ldiskfs"
544         E2FSCK="fsck.ldiskfs"
545         PFSCK="pfsck.ldiskfs"
546 ], [
547         AC_MSG_RESULT([disabled])
548         E2FSPROGS="e2fsprogs"
549         MKE2FS="mke2fs"
550         DEBUGFS="debugfs"
551         TUNE2FS="tune2fs"
552         E2LABEL="e2label"
553         DUMPE2FS="dumpe2fs"
554         E2FSCK="e2fsck"
555         PFSCK="fsck"
556 ])
557
558 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
559 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
560 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
561 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
562 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
563 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
564 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
565 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
566
567 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
568 AC_SUBST([MKE2FS], [$MKE2FS])
569 AC_SUBST([DEBUGFS], [$DEBUGFS])
570 AC_SUBST([TUNE2FS], [$TUNE2FS])
571 AC_SUBST([E2LABEL], [$E2LABEL])
572 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
573 AC_SUBST([E2FSCK], [$E2FSCK])
574 AC_SUBST([PFSCK], [$PFSCK])
575 ]) # LB_DEFINE_E2FSPROGS_NAMES