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