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