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